package com.atguigu.gmall.pay.config.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.io.FileWriter;
import java.io.IOException;

@ConfigurationProperties(prefix = "app.pay.alipay")
@Data
public class AlipayProperties {
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    private  String app_id = "2021000122604179";

    // 商户私钥，您的PKCS8格式RSA2私钥
    private  String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDMrbDKi6Z50RMSHlA7EA/YrMs/GOcKSgDDm5i+VOHU45d3ByszYw51f4PX6jc4w4o4eg/aPP91edZEq6vsiZ1mk5io9sBMBRcOe+Uxg+wZpBxGFtigl/pG1wjLprazU9wofjfoPcI8FNotY5aO9JuhzIvwPUur4rM/EjyfSwolVjLqLBjgI0LFzG0xtm/NrKTyJzmrSSbJB/XZnGZOBVvcrmKie5/9cfBIpnTqhmsnxtS2QOinZko7iht5VWFsOER4zBEsO2BDu6DA5/hLWosq8lRqpwh4OUje1C7HNhOBUPfWOgGDJ7CTI7iLc9Sp75oSt4R1+gatJcJrLZzUmnwDAgMBAAECggEAIt6QWOFTujsZMaQCbR1+ZZ6CfbxjWAhleu2eJwbU9mzTmA6bmISOqQvRTU50m/IMMTTyUG7F4qCgFVDd2E1ViG0qu9ZVyl2voOMQl8/uwCuKOZKY0zsxAzKNKAy94W0u+6MNKT6kQZIX3VWzB6W6geUUDhiTNLRJbzxPIaAqGVP46juheWqU4PO50ZDkccwnOVDAlpHyR0/PLuSOAiTBF9izUE8xwrjYYCTLw2sAsODqPTXertgSPKQaeCxpUGFVrGDXg8impwum5dcS5PsRy+oN4xG8YPE+S3KVikYsPD4HTOQlPcGRIzFPWnJsAZ8fUuS2JqTH9f0T4qJRfQCbqQKBgQD07eUBND7FKIRmIXzQ5mVtV/iDPkm9eTAS39Wb/TJNQ9ZWp1sGaChUIB3/3tNuG+Q5ZstT4E7HBQRbk+HkKNE0uu9Ie8oVkL18PuCCSd+3so78HaFgX+I6vFcPZTPLK+dcWR0Hvcf62H3yksxKrielqzV0FHew+28duE1bEJxRXQKBgQDV7gyhePGHyFPo84B+TkiXqcZMDTwbfFK6Tozf2k+ZzpIiG2ZBidroU/qq7GgfmlPw5pSbNE6taJdVXN31nw6Z2S6HDXvaGlNqhWxajwsB5sVNIbffM0pBaRy6718cDHJyCQmTKrk58Sl2vCaH/NsUHU9Gk5Bx7MEUL2XKmOhM3wKBgQCl1XDpaMtbSHykfeX5txVTfG2pxwG8hRI0pVMHA98MC3NTRorOArXTh89oECHNepsC9oOSrdwIym/R5YXbqntDnZIn3JDOGysAtb3i2UvdH8vKDfHWw/Tz2dOEe/wegwJqN3f9ZtTBFdXo6NXjdpknhY1yo+0KaqMoV0Ig91UvjQKBgQC8PyYELM20ovYbZbIq8q30LyPcJkU/Fm4hnR9fl9Y1zM1Qj/WyNCFaERPhtfeF36J/uBcKX8Pf2cpZBkgWa+lIPhEwLBBRAptmf5OyOG8CNFRnpAUNti9gUaNDZ4G0x8spR4SSaKTnNKw83CG3xivtjkEFJLKVXTUlkvOqjFTV1wKBgQC9sZqPp9kkc5rBPA3IZGOoqtARmbuivcm8LHxpUGaLcYILh6W58u7J7btY/OeSz5NIJqckgRWyPbT2REIel8ccRDp14iPHJkyWu/4qADNX2faneqdE+Bk5r3fgFpFIi5TL1ufRZNkcLwrhzrnCuWXvbHENGCHvgsw7jDGM+WhyOg==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    private  String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjneuywZwayfovN635A0tTfpw/bGJeMf/u2F5ptIH946qy143PSqC6PccvHe56qvERG4uagD7RuHLUiiM7/BG89PCFhpGSsFU49hE/w4om1jbZ2/CECYHKiMWWYZ0iRwUmaScaCVutW3BM/QmA0eOHDLHWD/t3YLK4H5VsvJ2jdsjddCQZlE8bpnn3+7rkgufehOKkRiv8YKarXg2oq7UZSvI60NF9/WN8TWsJ8c5pwixwss2DBq5dCRVoGSFXwP0MlxEBWhoXpc6QdgbN3kf/at1Qy7BfPcjstrQNQ+z2rMbLKxfwkYVQdEWRmz1Rf30STuu9blNmmEggHXh7BUbtwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    private  String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    private  String return_url = "http://localhost:8080/alipay_trade_page_pay_JAVA_UTF_8_Web_exploded/return_url.jsp";

    // 签名方式
    private  String sign_type = "RSA2";

    // 字符编码格式
    private  String charset = "utf-8";

    // 支付宝网关
    private  String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    private  String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    private  void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
